package com.yss.kettle.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import com.yss.common.core.utils.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yss.kettle.service.IJobTaskDetailsService;
import com.yss.kettle.mapper.JobTaskDetailsMapper;
import com.yss.kettle.domain.JobTaskDetails;

/**
 * 作业任务明细信息Service业务层处理
 *
 * @author yss
 * @date 2023-04-23
 */
@Slf4j
@Service
public class JobTaskDetailsServiceImpl extends ServiceImpl<JobTaskDetailsMapper, JobTaskDetails> implements IJobTaskDetailsService {
    /**
     * 查询作业任务明细信息列表
     *
     * @param jobTaskDetails 作业任务明细信息
     * @return 作业任务明细信息
     */
    @Override
    public List<JobTaskDetails> selectJobTaskDetailsList(JobTaskDetails jobTaskDetails) {
        QueryWrapper<JobTaskDetails> wrapper = new QueryWrapper();
        wrapper.orderByAsc("ORDER_NUM");
        if (StringUtils.isNull(jobTaskDetails)) {
            return this.list(wrapper);
        }
        if (StringUtils.isNotEmpty(jobTaskDetails.getTaskId())) {
            wrapper.eq("TASK_ID", jobTaskDetails.getTaskId());
        }
        if (StringUtils.isNotEmpty(jobTaskDetails.getInputDataId())) {
            wrapper.eq("INPUT_DATA_ID", jobTaskDetails.getInputDataId());
        }
        if (StringUtils.isNotEmpty(jobTaskDetails.getOutputDataId())) {
            wrapper.eq("OUTPUT_DATA_ID", jobTaskDetails.getOutputDataId());
        }
        if (StringUtils.isNotEmpty(jobTaskDetails.getOutputTable())) {
            wrapper.like("OUTPUT_TABLE", jobTaskDetails.getOutputTable());
        }
        return this.list(wrapper);
    }

}
